<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理系统</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f0f0f0;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h1,
        h2 {
            color: #333;
        }

        form {
            margin-bottom: 20px;
        }

        input[type="text"],
        input[type="password"],
        input[type="email"] {
            width: 100%;
            padding: 8px;
            margin: 5px 0;
            box-sizing: border-box;
        }

        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            cursor: pointer;
        }

        input[type="submit"]:hover {
            background-color: #45a049;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th,
        td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>管理系统</h1>

        <!-- 登录表单 -->
        <h2>登录</h2>
        <form id="loginForm" action="/api/v1/login" method="POST">
            <input type="text" name="username" placeholder="用户名" required>
            <input type="password" name="password" placeholder="密码" required>
            <input type="submit" value="登录">
        </form>

        <!-- 用户查询 -->
        <h2>用户查询</h2>
        <form id="searchForm" action="/api/v1/users/search" method="GET">
            <input type="text" name="searchTerm" placeholder="输入用户名或邮箱">
            <input type="submit" value="查询">
        </form>

        <!-- 用户列表 -->
        <h2>用户管理</h2>
        <table id="userTable">
            <tr>
                <th>ID</th>
                <th>用户名</th>
                <th>邮箱</th>
                <th>操作</th>
            </tr>
            <!-- 这里将通过JavaScript动态添加用户数据 -->
        </table>

        <!-- 添加用户表单 -->
        <h2>添加用户</h2>
        <form id="addUserForm" action="/api/v1/users" method="POST">
            <input type="text" name="username" placeholder="用户名" required>
            <input type="email" name="email" placeholder="邮箱" required>
            <input type="password" name="password" placeholder="密码" required>
            <input type="submit" value="添加用户">
        </form>

        <!-- 配置发件邮箱 -->
        <h2>配置发件邮箱</h2>
        <form id="emailConfigForm" action="/api/v1/admin_emails" method="POST">
            <input type="email" name="email" placeholder="SMTP邮箱地址" required>
            <input type="password" name="password" placeholder="SMTP密码" required>
            <input type="text" name="smtp_server" placeholder="SMTP服务器" required>
            <input type="number" name="smtp_port" placeholder="SMTP端口" required>
            <input type="submit" value="保存配置">
        </form>
    </div>

    <script>
        // 这里可以添加JavaScript代码来处理表单提交和与后端API的交互
        // 例如：获取用户列表
        fetch('/api/v1/users')
            .then(response => response.json())
            .then(data => {
                // 处理用户数据并更新表格
            });
    </script>
</body>

</html>